/**
 * @license
 * Copyright Akveo. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */

@import '../../core/mixins';

@mixin nb-b-input-group-theme() {

  $border-width: nb-theme(form-control-border-width);
  $border-type: nb-theme(form-control-border-type);
  $border-color: nb-theme(form-control-border-color);
  $form-control-border: $border-width $border-type $border-color;

  .input-group-addon,
  .input-group-icon {
    font-size: 1.5rem;
    padding: 0.25rem 1rem;
    color: nb-theme(form-control-placeholder-color);

    @include nb-ltr() {
      border-left: $form-control-border;
      border-right: none;
    };
    @include nb-rtl() {
      border-left: none;
      border-right: $form-control-border;
    };
  }

  .input-group-addon {
    &.primary {
      color: nb-theme(color-primary);
    }

    &.success {
      color: nb-theme(color-success);
    }

    &.warning {
      color: nb-theme(color-warning);
    }

    &.info {
      color: nb-theme(color-info);
    }

    &.danger {
      color: nb-theme(color-danger);
    }

    &.secondary {
      color: nb-theme(color-secondary);
    }
  }

  .input-group {
    .form-control:first-child:not(:only-child),
    .input-group-addon:first-child,
    .input-group-prepend .btn:first-child,
    .input-group-btn .btn:first-child {
      @include nb-ltr() {
        border-top-left-radius: nb-theme(form-control-border-radius);
        border-bottom-left-radius: nb-theme(form-control-border-radius);
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      };
      @include nb-rtl() {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-top-right-radius: nb-theme(form-control-border-radius);
        border-bottom-right-radius: nb-theme(form-control-border-radius);
      };
    }
    .form-control:last-child:not(:only-child),
    .input-group-addon:last-child,
    .input-group-append .btn:last-child,
    .input-group-btn .btn:last-child {
      @include nb-ltr() {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-top-right-radius: nb-theme(form-control-border-radius);
        border-bottom-right-radius: nb-theme(form-control-border-radius);
      };
      @include nb-rtl() {
        border-top-left-radius: nb-theme(form-control-border-radius);
        border-bottom-left-radius: nb-theme(form-control-border-radius);
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      };
    }

    .dropdown.show .btn.dropdown-toggle {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }

    .dropup.show .btn.dropdown-toggle {
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
  }

  .input-group-sm > .form-control {
    font-size: nb-theme(form-control-font-size-sm);
    padding: nb-theme(form-control-padding-sm);
    @include install-placeholder(nb-theme(form-control-placeholder-color),
      nb-theme(form-control-font-size-sm));
  }

  .input-group-lg > .form-control {
    font-size: nb-theme(form-control-font-size-lg);
    padding: nb-theme(form-control-padding-lg);
    @include install-placeholder(nb-theme(form-control-placeholder-color),
      nb-theme(form-control-font-size-lg));
  }

  .input-group-rounded > .form-control {
    border-radius: nb-theme(form-control-round-border-radius);
  }

  .input-group-border-only > .form-control {
    background: transparent;
  }

  .input-group-fill-only > .form-control {
    border-color: transparent;
  }

  .input-group-btn:not(:last-child) > .btn,
  .input-group-btn:not(:last-child) > .btn-group,
  .input-group-btn:not(:first-child) > .btn,
  .input-group-btn:not(:first-child) > .btn-group {
    margin: 0;
  }
}
